package com.example.test.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.test.entity.Cart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CartMapper extends BaseMapper<Cart> {
    @Insert("insert into Cart values (#{id},#{itemId})")
    public int insert(Cart cart);
    @Select("select * from Cart")
    List<Cart> selectAll();
    @Delete("delete from Cart ")
    public int deleteAll();
    @Delete("delete from Cart WHERE itemId = #{itemId}")
    public int deleteById(int itemId);
    @Select("select *from Cart WHERE itemId=#{itemId}")
    public Cart selectById(int itemId);
}
